﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using system.Windows.Forms;

namespace IDE_week2_Forms_project
{
    public partial class Form1 : Form
    {
        Bitmap bmp;
        bool en = false;

        public Form1()
        {

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
            InitializeComponent();
            bmp = this.Icon.ToBitmap();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 MyNewForm = new Form2();
            MyNewForm.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.ICON1;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            // Get an Hicon for myBitmap.
            IntPtr Hicon = bmp.GetHicon();

            // Create a new icon from the handle. 
            Icon newIcon = Icon.FromHandle(Hicon);

            // Set the form Icon attribute to the new icon. 
            this.Icon = newIcon;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {

            if (en)
            {
                ChangeLanguage("en");
                en = false;
            }
            else
            {
                ChangeLanguage("lt");
                en = true;
            }
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
        }
    }
}
